Polymorphic Type Reconstruction Using Type Equations

نویسنده

  • Venkatesh Choppella
چکیده

The W algorithm of Milner [Mil78] and its numerous variants [McA98,LY98,YTMW00] implement type reconstruction by building type substitutions. We define an algorithm W centered around building type equations rather than substitutions. The design of W is motivated by the belief that reasoning with substitutions is awkward. More seriously, substitutions fail to preserve the exact syntactic form of the type equations they solve. This makes analysing the source of type errors more difficult. By replacing substitution composition with unions of sets of type equations and eliminating the application of substitution to environments, we obtain an algorithm for type reconstruction that is simple and also useful for type error reconstruction. We employ a sequentiality principle for unifier composition and a constructive account of mgu-induced variable occurrence relation to design W and prove its correctness. We introduce syntax equations as a formal syntax for progam slices. We use a simple constraint generation relation to relate syntax equations with type equations to trace program slices responsible for a type error.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Inferring Cost Equations for Recursive, Polymorphic and Higher-Order Functional Programs

This paper presents a type-based analysis for inferring sizeand cost-equations for recursive, higher-order and polymorphic functional programs without requiring user annotations or unusual syntax. Our type reconstruction algorithm is capable of inferring cost equations for a subset of recursive programs whose costs can be expressed using primitive recursion. We illustrate the approach with refe...

متن کامل

On Extending Wand’s Type Reconstruction Algorithm to Handle Polymorphic Let⋆

We have extended Wand’s type reconstruction algorithm to polymorphic let by extending the constraint language and by using a multi-phase unification algorithm in the constraint solving phase. We show the correctness of our approach by extending the Wand’s soundness and completeness results. We have validated our approach against other popular type reconstruction algorithms by implementing OCaml...

متن کامل

Compiler-directed Type Reconstruction for Polymorphic Languages Compiler-directed Type Reconstruction for Polymorphic Languages

In tagless implementations of polymorphic languages, the run-time types of data objects may not be completely determined at compile-time. With ML-like static type-checking, a static type template can be produced for each polymorphic function that may be instantiated at run-time according to the types of its actual arguments. Still, as noted in 5], it may not be possible to reconstruct the types...

متن کامل

Functional encapsulation and type reconstruction in a strongly-typed, polymorphic language

Static type systems are traditionally used to prevent run-time type-errors in user programs and to assign appropriate storage representations to objects during compilation. In this thesis, we explore some new ways of using static type information in the design, compilation, and execution of programs written in a strongly-typed, polymorphic language. Programmers often nd it useful to know whethe...

متن کامل

On the Undecidability of Partial Polymorphic Type Reconstruction

We prove that partial type reconstruction for the pure polymorphic λ-calculus is undecidable by a reduction from the second-order unification problem, extending a previous result by H.-J. Boehm. We show further that partial type reconstruction remains undecidable even in a very small predicative fragment of the polymorphic λ-calculus, which implies undecidability of partial type reconstruction ...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2003